package cs343;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/**
* <p>
* Title: CS 343 Project: Pong
* </p>
* <p>
* Description: CS 343 Project  
* This class creates the arena frame that the game will be played in
* </p>
* 
* @author Jenny Windsperger, Stirling Pankow, Will Prew, Shane O'Malley-Potting
* @email jennifer.windsperger@my.uwrf.edu, stirling.pankow@my.uwrf.edu,
*        william.prew@my.uwrf.edu, shane.omalley-potting@my.uwrf.edu
* @date December 1st 2011
*/

public class ArenaContainer extends JFrame {
	
	private static final long serialVersionUID = 1L;
	
	//define the Arena and JPanel
	private Arena gameArena = null;
	private JPanel jContentPane = null;
	
	/**
	 * Default constructor that actually creates the game arena
	 */
	public ArenaContainer(){
		super();
		
		//cannot resize the arena
		this.setResizable(false);
		
		//set the size of the arena
		this.setMaximumSize(new Dimension(800, 420));
		this.setMinimumSize(new Dimension(800, 420));
		
		//set up the Arena object to be used in the jContentPane
		gameArena = new Arena();
		
		//set up the JContentPane to be passed to this JFrame
		jContentPane = new JPanel();
		jContentPane.setLayout(new BorderLayout());
		jContentPane.add(gameArena, BorderLayout.CENTER);
		
		this.setContentPane(jContentPane);
		this.setTitle("PONG");
		
		//listeners for key presses
		this.addKeyListener(new KeyAdapter(){
			//key pressed
			public void keyPressed(KeyEvent e){
				gameArena.pressedKey(e);
			}
			public void keyReleased(KeyEvent e){
				gameArena.releasedKey(e);
			}
		});
	}
	
}
